import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/check_layer_entity.dart';

CheckLayerEntity $CheckLayerEntityFromJson(Map<String, dynamic> json) {
  final CheckLayerEntity checkLayerEntity = CheckLayerEntity();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    checkLayerEntity.id = id;
  }
  final String? layerName = jsonConvert.convert<String>(json['layerName']);
  if (layerName != null) {
    checkLayerEntity.layerName = layerName;
  }
  final String? model = jsonConvert.convert<String>(json['model']);
  if (model != null) {
    checkLayerEntity.model = model;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    checkLayerEntity.status = status;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    checkLayerEntity.createDate = createDate;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    checkLayerEntity.updateDate = updateDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    checkLayerEntity.deleted = deleted;
  }
  final List<int>? mainList = (json['mainList'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<int>(e) as int).toList();
  if (mainList != null) {
    checkLayerEntity.mainList = mainList;
  }
  return checkLayerEntity;
}

Map<String, dynamic> $CheckLayerEntityToJson(CheckLayerEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['layerName'] = entity.layerName;
  data['model'] = entity.model;
  data['status'] = entity.status;
  data['createDate'] = entity.createDate;
  data['updateDate'] = entity.updateDate;
  data['deleted'] = entity.deleted;
  data['mainList'] = entity.mainList;
  return data;
}

extension CheckLayerEntityExtension on CheckLayerEntity {
  CheckLayerEntity copyWith({
    String? id,
    String? layerName,
    String? model,
    int? status,
    String? createDate,
    String? updateDate,
    String? deleted,
    List<int>? mainList,
  }) {
    return CheckLayerEntity()
      ..id = id ?? this.id
      ..layerName = layerName ?? this.layerName
      ..model = model ?? this.model
      ..status = status ?? this.status
      ..createDate = createDate ?? this.createDate
      ..updateDate = updateDate ?? this.updateDate
      ..deleted = deleted ?? this.deleted
      ..mainList = mainList ?? this.mainList;
  }
}